<template>
	<view class="">
		<!-- 扫码详情页面 -->
		<uni-collapse style="padding: 10rpx;">
			<uni-collapse-item class="collapseItem" :open="true">
				<template v-slot:title>
					<uni-icons type="image" color="#EB4B4B" size="20"></uni-icons>
					<text>物料信息</text>
				</template>
				<view class="content">
					<view class="contentItem">
						<text class="text">物料编码</text>
						<text>{{detail.categoryCode}}</text>
					</view>
					<view class="contentItem">
						<text class="text">物料名称</text>
						<text>{{detail.categoryName}}</text>
					</view>
				</view>
			</uni-collapse-item>
			<uni-collapse-item class="collapseItem" :open="true">
				<template v-slot:title>
					<uni-icons type="image" color="#EB4B4B" size="20"></uni-icons>
					<text>标签信息</text>
				</template>
				<view class="content">
					<view class="contentItem">
						<text class="text">标签ID</text>
						<text style="color: #007AFF;"  @click="schemeert(detail.resourceAssetCode,detail.labelId)">{{(detail.labelId!=null&&detail.resourceAssetCode!=null)?detail.labelId:""}}</text>
			            <text style="color: black;">{{(detail.labelId==null||detail.resourceAssetCode==null)?detail.labelId:""}}</text>
					</view>
					<view class="contentItem">
						<text class="text">资源资产编码</text>
						<text>{{detail.resourceAssetCode}}</text>
					</view>
				</view>
			</uni-collapse-item>
			<uni-collapse-item class="collapseItem" :open="true">
				<template v-slot:title>
					<uni-icons type="image" color="#EB4B4B" size="20"></uni-icons>
					<text>项目信息</text>
				</template>
				<view class="content">
					<view class="contentItem">
						<text class="text">项目编码</text>
						<text>{{detail.prjCode}}</text>
					</view>
					<view class="contentItem">
						<text class="text">项目名称</text>
						<text style="display: inline-block;width: 65%;">{{detail.prjName}}</text>
					</view>
					<view class="contentItem">
						<text class="text">站址名称</text>
						<text>{{detail.siteName}}</text>
					</view>
					<view class="contentItem">
						<text class="text">站址编码</text>
						<text>{{detail.siteId}}</text>
					</view>
				</view>
			</uni-collapse-item>
		</uni-collapse>
		<view class="buttonBox">
			<view class="" style="width: 50%;display: inline-block;">
				<button type="warn" style="height: 100rpx;line-height: 100rpx;font-size: 30rpx;">绑定</button>
			</view>
			<view class="" style="width: 50%;display: inline-block;">
				<button @click="cancle" :plain="true" type="warn" style="height: 100rpx;line-height: 100rpx;font-size: 30rpx;">取消</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				prjId:null,
				labelId:null,
				operatType:null,
				saomaType:null,
				detail:{},
			}
		},
		onLoad(option) {
			this.prjId = option.prjId
			this.labelId = option.labelId
		},
		methods: {
			 // 跳转至经分系统
      schemeert(options,amger){
        this.$axios.get('/material/api/pub/material/getOtherSysIpAndPort',{ sysCode:'jingFenSysIpAndPort'}).then((res)=>{
          imp.iWindow.open({url:`${res.data}/api/user/getRedirectToBcsystem?resourceAssetCode=${options}&elabelNum=${amger}`})
        })
			},
			getDetail(prjId,labelId,operatType){
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				uni.request({
					// url: uni.getStorageSync('url') + "/pms/app/complete/queryScanConfirmInfo?prjId="+prjId+"&labelId="+labelId+"&isFromPhoto=1"+"&operatType="+operatType,
					//url: uni.getStorageSync("PMS20url") + "/api/app/mainMaterialLable/scanLableConfirm?prjId="+prjId+"&labelId="+labelId+"&isFromPhoto=1"+"&operatType="+operatType,
					url: uni.getStorageSync("PMS20url") + "/api/app/mainMaterialLable/scanLableConfirm",
					method: 'POST',
					dataType: 'json',
					timeout: 10000 * 60,
					header: {
						"sysToken": uni.getStorageSync("PMStoken"),
					},
					data: {
						 prjId: prjId,
						 labelId:labelId,
						 isFromPhoto:"1",
						 operatType:operatType,
						 file:"",
						 
					},
					success: (res) => {
						uni.hideLoading();
						var data = res.data;
						if (data.code == "200") {
							if(data.data.servicSetate==1){
								this.detail = data.data.scanConfirmData
							}
						}else if(data.code == "999"){
							
						}else {
							uni.showModal({
								title: '温馨提示',
								content: data.message,
								showCancel: false,
                confirmColor: '#eb4b4b',
							})
						}
				
						uni.hideLoading();
						uni.stopPullDownRefresh();
				
					},
					fail: (data, code) => {
						uni.hideLoading();
						uni.stopPullDownRefresh();
						console.log('fail' + JSON.stringify(data));
					}
				});
			}
		}
	}
	
</script>

<style>
	@import '@/common/common-ui.css';
</style>
<style scoped lang="scss">
	.collapseItem{
		border: 1px solid #E4E4E4;
		border-bottom: 0;
		margin: 6rpx 0;
		.content{
			.contentItem{
				border-top: 1px solid #E4E4E4;
				padding: 20rpx 0;
				display: flex;
				.text{
					width: 30%;
					display: inline-block;
					margin-left: 5%;
					
				}
			}
		}
	}
	.buttonBox{
		position: fixed;
		bottom: 22vh;
		width: 100vw;
	}
</style>
